<?php

require_once dirname(__FILE__) . '/../../Extension/Params.php';
require_once dirname(__FILE__) . '/TextValues.php';


class Rase_Extension_WowappParams extends Raws_Extension_Params
{
  
  // protected $_rootNamespace = 'raws';
  // protected $_rootElement = 'params';

    # child elements of the params element
    protected $_id = null;
    protected $_name = null;
    protected $_username = null;
    protected $_description = null;
    protected $_stream_type = null;
    protected $_stream_uri = null;
    protected $_master_uri = null;
    protected $_broadcast_domain = null;
    protected $_broadcast_ip = null;
    protected $_broadcast_backup_domain = null;
    protected $_broadcast_backup_ip = null;
    protected $_secure_token = null;
    protected $_broadcast_application = null;
    protected $_db_only = null;

    public function __construct($name = null, $username = null, $stream_type = null, $stream_uri = null) 
    {
        parent::__construct();
        $this->setName($name);
        $this->setUsername($username);
        $this->setStreamType($stream_type);
        $this->setStreamUri($stream_uri);
    }
    
    /**
     * Retrieves a DOMElement which corresponds to this element and all
     * child properties.  This is used to build an entry back into a DOM
     * and eventually XML text for application storage/persistence.
     *
     * @param DOMDocument $doc The DOMDocument used to construct DOMElements
     * @return DOMElement The DOMElement representing this element and all
     *          child properties.
     */
    public function getDOM($doc = NULL, $majorVersion = 1, $minorVersion = NULL)
    {
        $element = parent::getDOM($doc);
        if ($this->_id !== null) {
            $element->appendChild($this->_id->getDOM($element->ownerDocument));
        }
        if ($this->_name !== null) {
            $element->appendChild($this->_name->getDOM($element->ownerDocument));
        }
        if ($this->_username !== null) {
            $element->appendChild($this->_username->getDOM($element->ownerDocument));
        }
        if ($this->_description !== null) {
            $element->appendChild($this->_description->getDOM($element->ownerDocument));
        }
        if ($this->_stream_type !== null) {
            $element->appendChild($this->_stream_type->getDOM($element->ownerDocument));
        }
        if ($this->_stream_uri !== null) {
            $element->appendChild($this->_stream_uri->getDOM($element->ownerDocument));
        }
        if ($this->_master_uri !== null) {
            $element->appendChild($this->_master_uri->getDOM($element->ownerDocument));
        }
        if ($this->_broadcast_domain !== null) {
            $element->appendChild($this->_broadcast_domain->getDOM($element->ownerDocument));
        }
        if ($this->_broadcast_ip !== null) {
            $element->appendChild($this->_broadcast_ip->getDOM($element->ownerDocument));
        }
        if ($this->_broadcast_backup_domain !== null) {
            $element->appendChild($this->_broadcast_backup_domain->getDOM($element->ownerDocument));
        }
        if ($this->_broadcast_backup_ip !== null) {
            $element->appendChild($this->_broadcast_backup_ip->getDOM($element->ownerDocument));
        }
        if ($this->_secure_token !== null) {
            $element->appendChild($this->_secure_token->getDOM($element->ownerDocument));
        }
        if ($this->_broadcast_application !== null) {
            $element->appendChild($this->_broadcast_application->getDOM($element->ownerDocument));
        }
        if ($this->_db_only !== null) {
            $element->appendChild($this->_db_only->getDOM($element->ownerDocument));
        }
        return $element;
    }

    /**
     * Creates individual Entry objects of the appropriate type and
     * stores them as members of this entry based upon DOM data.
     *
     * @param DOMNode $child The DOMNode to process
     */
    protected function takeChildFromDOM($child)
    {
        $absoluteNodeName = $child->namespaceURI . ':' . $child->localName;
        
        switch ($absoluteNodeName) {
            case $this->lookupNamespace('raws') . ':' . 'id'; 
                $id = new Rase_Extension_Id();
                $id->transferFromDOM($child);
                $this->_id = $id;
                break;
            case $this->lookupNamespace('raws') . ':' . 'name'; 
                $name = new Rase_Extension_Name();
                $name->transferFromDOM($child);
                $this->_name = $name;
                break;
            case $this->lookupNamespace('raws') . ':' . 'username'; 
                $username = new Rase_Extension_Username();
                $username->transferFromDOM($child);
                $this->_username = $username;
                break;
            case $this->lookupNamespace('raws') . ':' . 'description'; 
                $description = new Rase_Extension_Description();
                $description->transferFromDOM($child);
                $this->_description = $description;
                break;
            case $this->lookupNamespace('raws') . ':' . 'stream_type'; 
                $stream_type = new Rase_Extension_StreamType();
                $stream_type->transferFromDOM($child);
                $this->_stream_type = $stream_type;
                break;
            case $this->lookupNamespace('raws') . ':' . 'stream_uri'; 
                $stream_uri = new Rase_Extension_StreamUri();
                $stream_uri->transferFromDOM($child);
                $this->_stream_uri = $stream_uri;
                break;
            case $this->lookupNamespace('raws') . ':' . 'master_uri'; 
                $master_uri = new Rase_Extension_MasterUri();
                $master_uri->transferFromDOM($child);
                $this->_master_uri = $master_uri;
                break;
            case $this->lookupNamespace('raws') . ':' . 'broadcast_domain'; 
                $broadcast_domain = new Rase_Extension_BroadcastDomain();
                $broadcast_domain->transferFromDOM($child);
                $this->_broadcast_domain = $broadcast_domain;
                break;
            case $this->lookupNamespace('raws') . ':' . 'broadcast_ip'; 
                $broadcast_ip = new Rase_Extension_BroadcastIp();
                $broadcast_ip->transferFromDOM($child);
                $this->_broadcast_ip = $broadcast_ip;
                break;
            case $this->lookupNamespace('raws') . ':' . 'broadcast_backup_domain'; 
                $broadcast_backup_domain = new Rase_Extension_BroadcastBackupDomain();
                $broadcast_backup_domain->transferFromDOM($child);
                $this->_broadcast_backup_domain = $broadcast_backup_domain;
                break;
            case $this->lookupNamespace('raws') . ':' . 'broadcast_backup_ip'; 
                $broadcast_backup_ip = new Rase_Extension_BroadcastBackupIp();
                $broadcast_backup_ip->transferFromDOM($child);
                $this->_broadcast_backup_ip = $broadcast_backup_ip;
                break;
            case $this->lookupNamespace('raws') . ':' . 'secure_token'; 
                $secure_token = new Rase_Extension_SecureToken();
                $secure_token->transferFromDOM($child);
                $this->_secure_token = $secure_token;
                break;
            case $this->lookupNamespace('raws') . ':' . 'broadcast_application'; 
                $broadcast_application = new Rase_Extension_BroadcastApplication();
                $broadcast_application->transferFromDOM($child);
                $this->_broadcast_application = $broadcast_application;
                break;
            case $this->lookupNamespace('raws') . ':' . 'db_only'; 
                $db_only = new Rase_Extension_DbOnly();
                $db_only->transferFromDOM($child);
                $this->_db_only = $db_only;
                break;
            default:
                parent::takeChildFromDOM($child);
                break;
        }
    }

    public function getId()
    {
        return $this->_id;
    }

    public function setId($value)
    {
        $this->_id = $value;
        return $this;
    }
    
    public function getName()
    {
        return $this->_name;
    }

    public function setName($value)
    {
        $this->_name = $value;
        return $this;
    }

    public function getUsername()
    {
        return $this->_username;
    }

    public function setUsername($value)
    {
        $this->_username = $value;
        return $this;
    }


    public function getDescription()
    {
        return $this->_description;
    }

    public function setDescription($value)
    {
        $this->_description = $value;
        return $this;
    }

    public function getStreamType()
    {
        return $this->_stream_type;
    }

    public function setStreamType($value)
    {
        $this->_stream_type = $value;
        return $this;
    }

    public function getStreamUri()
    {
        return $this->_stream_uri;
    }

    public function setStreamUri($value)
    {
        $this->_stream_uri = $value;
        return $this;
    }

    public function getMasterUri()
    {
        return $this->_master_uri;
    }

    public function setMasterUri($value)
    {
        $this->_master_uri = $value;
        return $this;
    }

    public function getBroadcastDomain()
    {
        return $this->_broadcast_domain;
    }

    public function setBroadcastDomain($value)
    {
        $this->_broadcast_domain = $value;
        return $this;
    }

    public function getBroadcastIp()
    {
        return $this->_broadcast_ip;
    }

    public function setBroadcastIp($value)
    {
        $this->_broadcast_ip = $value;
        return $this;
    }

    public function getBroadcastBackupDomain()
    {
        return $this->_broadcast_backup_domain;
    }

    public function setBroadcastBackupDomain($value)
    {
        $this->_broadcast_backup_domain = $value;
        return $this;
    }

    public function getBroadcastBackupIp()
    {
        return $this->_broadcast_backup_ip;
    }

    public function setBroadcastBackupIp($value)
    {
        $this->_broadcast_backup_ip = $value;
        return $this;
    }

    public function getSecureToken()
    {
        return $this->_secure_token;
    }

    public function setSecureToken($value)
    {
        $this->_secure_token = $value;
        return $this;
    }
    
    public function getBroadcastApplication()
    {
        return $this->_broadcast_application;
    }

    public function setBroadcastApplication($value)
    {
        $this->_broadcast_application = $value;
        return $this;
    }

    public function getDbOnly()
    {
        return $this->_db_only;
    }

    public function setDbOnly($value)
    {
        $this->_db_only = $value;
        return $this;
    }


}
